package com.icen.template.test;

import com.baidu.mapapi.map.MapView;
import com.icen.template.app.APPContext;
import com.icen.utils.baidu.map.BaiduMapUtils;

import android.app.Activity;
import android.os.Bundle;

public class MainActivity extends Activity {
	private BaiduMapUtils mBaiduMapUtils = null;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		// 初始化百度地图SDK
		BaiduMapUtils.initBaiduSDK(APPContext.getAPPContext());
		setContentView(R.layout.activity_main);

		// 实例化工具类
		MapView mapView = (MapView) findViewById(R.id.baiduMapView);
		mBaiduMapUtils = BaiduMapUtils.getInstance(mapView);
		
		mBaiduMapUtils.setMapTypeToSatellite();
	}

	@Override
	protected void onDestroy() {
		super.onDestroy();
		if (mBaiduMapUtils != null) {
			mBaiduMapUtils.onDestroyMap();
		}
	}

	@Override
	protected void onResume() {
		super.onResume();
		if (mBaiduMapUtils != null) {
			mBaiduMapUtils.onResumeMap();
		}
	}

	@Override
	protected void onPause() {
		super.onPause();
		if (mBaiduMapUtils != null) {
			mBaiduMapUtils.onPauseMap();
		}
	}
}
